<template>
	<view class="tj-top">
		<view class="tj-top-txx br-bottm" @click="toggleMask('show')">
			<view class="wz21">用户图片 </view>
			<view class="tx21">
				<image v-if="payImg" class="portraitw" :src="payImg" @click="viewImg(payImg)"></image>
				<text v-else>点击上传图片</text>
			</view>
			<view class="tj-top-tleft">
				<image src="" mode=""></image>
			</view>
		</view>
		<!-- 面板 -->
		<view class="mask" :class="maskState===0 ? 'none' : maskState===1 ? 'show' : ''" @click="toggleMask">
			<view class="mask-content" @click.stop.prevent="stopPrevent">
				<view>
					<view class="xx" @click="toggleMask">
						x
					</view>
					<text>点击上传图片</text>
					<view class="phone_text_box phone_text_box2">
						<vastwu-saveimg :imgListprop="img_list" :num='1' :isBase64='true' :isSave='true' :size='180' @chooseImage='imglist_msg'
						 @delImg='del_imglist_msg'></vastwu-saveimg>
						<view class="phone_tj" @click="updateImg()"><text>提交</text></view>
					</view>

				</view>

			</view>
		</view>



	</view>
</template>

<script>
	import vastwuSaveimg from '../../../components/vastwu-saveimg/vastwu-saveimg.vue'

	export default {
		components: {
			vastwuSaveimg
		},
		data() {
			return {
				maskState: 0, //面板显示状态
				img_list: [],
				payImg: ''
			}
		},
		onShow() {},
		methods: {
			toggleMask(type, mobile) {
				let timer = type === 'show' ? 10 : 300;
				let state = type === 'show' ? 1 : 0;
				this.maskState = state;

			},
			imglist_msg(e) { //上传成功返回
				this.payImg = e[0]
				console.log('上传成功返回', e)
			},
			del_imglist_msg(e) { //删除成功返回
				console.log('删除成功返回', e)
			},
			stopPrevent() {},
			updateImg() { //提交图片
				let that = this
				if (this.payImg == '') {
					this.$msg('还未上传图片')
					return
				}
				let params = {
					payImg: this.payImg
				}
				console.log(params)
			},
			async viewImg(path) {
				uni.previewImage({
					urls: path
				});




			},
		}
	}
</script>

<style scoped lang="less">
	page {
		color: #333333;
	}

	.tj-top {
		padding: 30rpx;
	}

	.tj-top-txx {
		display: flex;
		width: 100%;
		align-items: center;
		justify-content: space-between;
		padding: 12px 15px;
		color: #3b4144;
	}

	.tx {
		width: 100rpx;
		height: 100rpx;
		display: block;
		border-radius: 50%;
		overflow: hidden;
	}

	.tx21 {
		color: red;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.wz21 {}


	.tj-top-tleft {
		width: 40rpx;
		height: 40rpx;
	}

	.br-bottm {
		border-bottom: 1px solid #dadada;
	}

	image {
		width: 100%;
		height: 100%;
	}

	.tx21 image {
		width: 200rpx;
		height: 200rpx;
	}

	/* 优惠券面板 */
	.mask {
		display: flex;
		align-items: flex-end;
		position: fixed;
		left: 0;
		top: var(--window-top);
		bottom: 0;
		width: 100%;
		background: rgba(0, 0, 0, 0);
		z-index: 1;
		transition: .3s;

		.mask-content {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate3d(-50%, -50%, 0);
			width: 80%;
			min-height: 30vh;
			max-height: 50vh;
			background: #f3f3f3;
			transition: .3s;
			text-align: center;
			box-sizing: border-box;
			padding: 20rpx 10rpx;
			border-radius: 8rpx;

			.xx {
				position: relative;
				right: 0;
				float: right;
				top: -20rpx;
				font-size: 42rpx;
			}

			.phone_text_box {}

			.phone_text_box2 {
				padding: 10rpx;
			}

			.phone_text {
				padding-top: 40rpx;
				padding-bottom: 20rpx;

				input {
					border-bottom: 1px solid #dadada;
					line-height: 120rpx;
					height: 120rpx;
				}
			}

			.ts {
				color: #FF0000;
				width: 100%;
				text-align: left;
				padding-bottom: 20rpx;
				display: block;
			}

			.phone_tj {
				width: 100%;
				height: 100rpx;
				margin-top: 20rpx;

				text {
					display: block;
					line-height: 60rpx;
					margin: auto;
					width: 200rpx;
					color: #FFFFFF;
					border-radius: 8rpx;
					background-color: #9DD26D;
				}

			}
		}

		&.none {
			display: none;
		}

		&.show {
			background: rgba(0, 0, 0, .4);

			.mask-content {}
		}
	}
</style>
